//生成从minNum到maxNum的随机数
function randomNum(minNum = 0, maxNum = 1) {
  return parseInt(minNum + (maxNum - minNum) * Math.random());
}

function randomStr(num = 8) {
  return Math.random()
    .toString(36)
    .slice(num * -1);
}
// 生成随机颜色
function randomColor() {
  return (
    "#" + ("00000" + ((Math.random() * 0x1000000) << 0).toString(16)).substr(-6)
  );
}

const toolRandom = {
  randomNum,
  randomColor,
  randomStr,
};

export default toolRandom;
